#ifndef DOUBAN_NOTIFY_NOTIFICATIONMODULE_H
#define DOUBAN_NOTIFY_NOTIFICATIONMODULE_H

#include "NewNotifyDialog.h"
#include <QNetworkReply>
#include <QObject>
#include <QTimer>

namespace Douban
{
	class DoubanContext;
	class NewNotifyDialog;
	class NotificationModule : public QObject
	{
		Q_OBJECT
		public:
			NotificationModule(DoubanContext*);
			void setUpdateInterval(int millsec);

			~NotificationModule()
			{
				if(r_getNotifyReply)
					r_getNotifyReply->abort();
			}

		private:
			bool			b_isChecking;
			DoubanContext*	m_context;
			NewNotifyDialog m_notifyDialog;
			QTimer			m_checkNotifyTimer;
			QNetworkReply*	r_getNotifyReply;

		private slots:
			void checkNotify();
			void checkFinished();
		friend class NewNotifyDialog;
	};
}
#endif // NOTIFICATIONMODULE_H
